home *** CD-ROM | disk | FTP | other *** search
/ Know Your Hockey - The Greatest Player Resource / Know Your Hockey: The Greatest Player Resource.iso / hockey / director / ssqcst.cst / 00067_Script_PopUpMenu Script--using Movie in a window < prev    next >
Text File  |  1998-09-28  |  4KB  |  141 lines

  1. -- the popup menu is a separate movie that is openined over the current movie
  2. -- the global gPop stores the name of the popup window
  3.  
  4. global gPop,gPopButtonState,gSubPop
  5.  
  6.  
  7. -- launches and positions the popup menu
  8.  
  9. -- popname = file name & the window's name
  10. -- posV = the window's vertical position
  11. -- posh = the window's horizontal position
  12. -- W = width
  13. -- h = height
  14. -- level defines which pop menus will close 
  15. --  level 1 all
  16. -- level 2 only those above 1 etc.
  17.  
  18. on InitPopMenu popname,posV,posH,W,H,level
  19.   if voidp(gpop) then set gpop = []
  20.   losePop (window level)
  21.   if the result > 0 then exit
  22.   set temp = window popname
  23.   set the filename of temp to popname 
  24.   set the windowtype of temp to 2
  25.   FindCurentStageLocation posV,posH,W,H, temp
  26.   open temp
  27.   -- check to see if it is has been created
  28.   --  pause the correct windows
  29.   -- I didn't use the window list to this
  30.   set c = getone(gPop temp)
  31.   if c = 0 then append gPop temp
  32.   set s = getone(gPop temp)
  33.   case s of
  34.     1: tell the stage to pause
  35.       set the mousedownscript to "limitedfunction"
  36.     2:
  37.       tell  getat(gpop,1) to set the mousedownscript to "limitedfunctionPoP"
  38.       tell getat(gpop,1) to pause
  39.     3:
  40.       tell getat(gpop,2) to pause
  41.   end case 
  42. end
  43.  
  44.  
  45. -- examines the current location of the stage  then positions the popup window correctly
  46.  
  47. on FindCurentStageLocation posV,posH,W,H,temp
  48.   set x = the rect of the stage
  49.   set topX = posH+value(the left of x) -- position on stage offset by the stage pos on the screen
  50.   set topY = PosV+value(the top of x)-- position on stage offset by the stage pos on the screen
  51.   set BottomX = H+topX-- bottom corner = top corner plus desired window size (in bold)
  52.   set BottomY = W+TopY--bottom corner = top corner plus desired window size (in bold)
  53.   -- set BottomLeft = value(item 3 of temp)
  54.   -- set BottomRight = value(item 4 of temp)
  55.   set the rect of temp to rect(TopX,TopY,BottomX,BottomY)
  56. end
  57.  
  58. -- closes  all the popup menus
  59.  
  60. on LosePop level
  61.   if gpop = [] then 
  62.     return 0
  63.     exit
  64.   end if
  65.   
  66.   -- if the exit is present when subpop called close it first
  67.   set a =getone(gPop,(window "exit"))
  68.   
  69.   if  level = (window "subpop") and a > 0 then 
  70.     Close (window "exit")
  71.     Forget (window "exit")
  72.     deleteat(gPop,a)
  73.   end if
  74.   
  75.   set start = getone(gPop,level)
  76.   
  77.   if start = 0 then exit 
  78.   set range = count(gPop) 
  79.   repeat with x = range down to start
  80.     set popout = getat(gPop,x)
  81.     Close popout
  82.     forget popout
  83.   end repeat
  84.   
  85.   repeat with x = range down to start
  86.     deleteat(gPop,x)
  87.   end repeat
  88.   
  89.   
  90.   
  91.   -- check to see what windows still exist and make the top one
  92.   -- active again
  93.   set t = count(gPop)
  94.   case t of
  95.     0:  continue
  96.       bgmusic
  97.       resetbanner
  98.       set the mousedownscript to EMPTY
  99.       
  100.     1:
  101.       set active = getat(gpop,1)
  102.       tell active to continue
  103.     2: 
  104.       set active = getat(gpop,2)
  105.       tell active to continue
  106.   end case 
  107.   return start
  108. end
  109.  
  110.  
  111. -- this script is assigned to the mousedown for the stage when a pop
  112. -- menu is open and dismissed when it is closed
  113. -- it only allows clicks to the background and the ball button to
  114. -- dismiss the pop menus
  115. -- this script is assigned to the mousedown for the stage when a pop
  116. -- menu is open and dismissed when it is closed
  117. -- it only allows clicks to the background and the ball button to
  118. -- dismiss the pop menus
  119. -- variables
  120. --     a = a list containing the sprite numbers of buttons to exempt
  121. --     b = the current button clicked
  122. on limitedfunction 
  123.   set a =[1,18]
  124.   set b = the clickon
  125.   repeat with x in a
  126.     set t = x
  127.     if b = t then 
  128.       set exempt = 1
  129.       exit repeat
  130.     end if
  131.   end repeat
  132.   if exempt = 1 then
  133.     continue
  134.     Pass
  135.   else
  136.     losepop(window "pop")
  137.     dontPassEvent
  138.   end if
  139.   
  140. end
  141.